<!DOCTYPE html>
<html>
<head>
    <title>${systitle!}管理平台</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="pragma" content="no-cache"/>
    <meta http-equiv="cache-control" content="no-cache,no-store,max-age=0"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <script type="text/javascript">
        var contextPath = '${request.contextPath}';
        var mainurl = '${mainurl!}';
        var oid = '${sysorg!}';
    </script>

    <!-- 处理黑框 -->


    <link rel="stylesheet" href="${request.contextPath}/lib/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="${request.contextPath}/lib/bootstrap/css/bootstrapValidator.css">
    <link rel="stylesheet" href="${request.contextPath}/lib/bootstrap/css/bootstrap.dialog.css">
    <link rel="stylesheet" href="${request.contextPath}/css/font-awesome.min.css">
    <link rel="stylesheet" href="${request.contextPath}/css/ionic.min.css">
    <link rel="stylesheet" href="${request.contextPath}/css/loading.css">
    <link rel="stylesheet" href="${request.contextPath}/lib/plugins/select2/select2.min.css">
    <link rel="stylesheet" href="${request.contextPath}/css/AdminLTE.css">
    <link rel="stylesheet" href="${request.contextPath}/css/skins/_all-skins.css">
    <link rel="stylesheet" href="${request.contextPath}/lib/plugins/artDialog/ui-dialog.css">
    <link rel="stylesheet" href="${request.contextPath}/css/index.css">
    <link rel="stylesheet" href="${request.contextPath}/lib/plugins/layer/skin/default/layer.css">
    <link rel="stylesheet" href="${request.contextPath}/lib/plugins/bootstrap-tagsinput-latest/bootstrap-tagsinput.css">
    <link rel="stylesheet" href="${request.contextPath}/lib/plugins/zTree3/css/zTreeStyle/zTreeStyle.css"
          type="text/css">
    <link rel="stylesheet" href="${request.contextPath}/lib/plugins/zTree3/css/zTreeStyle/ztreeTable.css">
    <script src="${request.contextPath}/lib/plugins/bootstrap-fileinput-master/css/fileinput.min.css"></script>
    <script src="${request.contextPath}/lib/plugins/jQuery/jQuery-2.1.4.min.js"></script>
    <script src="${request.contextPath}/lib/plugins/jQueryUI/jquery-ui.min.js"></script>
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="${request.contextPath}/lib/plugins/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="${request.contextPath}/lib/plugins/respond/1.4.2/respond.min.js"></script>
    <![endif]-->


    <!-- 陈兴斌样式，数据引用 -->
    <link rel="stylesheet" href="${request.contextPath}/lib/plugins/datatables/dataTables.bootstrap.css">
    <script src="${request.contextPath}/lib/plugins/datatables/jquery.dataTables.min.js"></script>
    <script src="${request.contextPath}/lib/plugins/datatables/dataTables.buttons.js"></script>
    <script src="${request.contextPath}/lib/plugins/datatables/dataTables.bootstrap.min.js"></script>
    <script src="${request.contextPath}/lib/plugins/datatables/buttons.bootstrap.js"></script>

    <link href="${request.contextPath}/lib/plugins/bootstrap-fileinput-master/css/fileinput.css" media="all"
          rel="stylesheet" type="text/css"/>
    <link href="${request.contextPath}/lib/plugins/bootstrap-fileinput-master/themes/explorer/theme.css" media="all"
          rel="stylesheet" type="text/css"/>
    <script src="${request.contextPath}/lib/plugins/bootstrap-fileinput-master/js/plugins/sortable.js"
            type="text/javascript"></script>
    <script src="${request.contextPath}/lib/plugins/bootstrap-fileinput-master/js/fileinput.js"
            type="text/javascript"></script>
    <script src="${request.contextPath}/lib/plugins/bootstrap-fileinput-master/js/locales/zh.js"
            type="text/javascript"></script>
    <script src="${request.contextPath}/lib/plugins/bootstrap-fileinput-master/js/locales/es.js"
            type="text/javascript"></script>
    <script src="${request.contextPath}/lib/plugins/bootstrap-fileinput-master/themes/explorer/theme.js"
            type="text/javascript"></script>
    <script src="${request.contextPath}/lib/plugins/bootstrap-tagsinput-latest/bootstrap-tagsinput.js"></script>
    <!--<script src="${request.contextPath}/lib/plugins/bootstrap-tagsinput-latest/bootstrap-tagsinput-angular.js"></script>-->

    <script src="${request.contextPath}/lib/plugins/zTree3/js/jquery.ztree.core.js"></script>
    <script src="${request.contextPath}/lib/plugins/zTree3/js/jquery.ztree.excheck.js"></script>
    <script src="${request.contextPath}/lib/plugins/zTree3/js/jquery.ztree.exedit.js"></script>
    <script type="text/javascript" src="${request.contextPath}/lib/plugins/select2/select2.full.min.js"></script>
    <script type="text/javascript" src="${request.contextPath}/lib/plugins/select2/i18n/zh-CN.js"></script></span>


    <script src="${request.contextPath}/lib/plugins/jQuery.cxSelect-1.4.1/jquery.cxselect.js"></script>

    <script type="text/javascript" src="${request.contextPath}/js/aboutForm.js"></script>
    <!-- -------------------------------------------------------------------------------- -->
    <!-- layui 插件 -->
    <link rel="stylesheet" href="${request.contextPath}/lib/plugins/layui/css/layui.css">
    <script src="${request.contextPath}/lib/plugins/layui/layui.all.js"></script>
    <!-- layui 插件 -->

    <script src="${request.contextPath}/lib/bootstrap/js/bootstrap.min.js"></script>
    <script src="${request.contextPath}/lib/bootstrap/js/bootstrap.dialog.js"></script>
    <script src="${request.contextPath}/lib/bootstrap/js/bootstrapValidator.js"></script>

    <link rel="stylesheet" href="${request.contextPath}/lib/plugins/datepicker/datepicker3.css">
    <script src="${request.contextPath}/lib/plugins/datepicker/bootstrap-datepicker.js"></script>
    <script src="${request.contextPath}/lib/plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js"></script>

    <script src="${request.contextPath}/lib/plugins/artDialog/dialog-min.js"></script>
    <script src="${request.contextPath}/lib/plugins/artDialog/dialog-plus-min.js"></script>
    <script src="${request.contextPath}/lib/plugins/daterangepicker/moment.min.js"></script>
    <style>
        .content-wrapper{
            background-color: rgba(243, 243, 243, 1);
        }
        /*.box {*/
            /*position: relative;*/
            /*border-radius: 3px;*/
            /*background: #ffffff;*/
            /*border-top: 3px solid #d2d6de;*/
            /*margin-bottom: 20px;*/
            /*width: 100%;*/
            /*box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);*/
        /*}*/
    </style>
</head>
<body class="hold-transition skin-blue sidebar-mini fi">
<div class="wrapper">
    <#include "header.html"/>
    <#include "menu.html"/>
    <audio id="chatAudio"><source src="${request.contextPath}/js/notify.ogg" type="audio/ogg">
        <source src="${request.contextPath}/js/notify.mp3" type="${request.contextPath}/js/audio/mpeg"><source src="${request.contextPath}/js/notify.wav" type="audio/wav">
    </audio>
    <!-- 主要内容 开始 -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header" id="content-header">
            <h1>
                系统首页
                <small>面板</small>
            </h1>
            <!--<ol class="breadcrumb">-->
                <!--<li><a href="javaSctipt:void(0);" onclick="soaIndexfn()"><i class="fa fa-dashboard"></i> 首页</a></li>-->
                <!--<li class="active">面板</li>-->
            <!--</ol>-->
        </section>

        <!-- Main content -->
        <section class="content">


        </section>
        <!-- /.content -->
    </div>
    <!-- 主要内容 结束 -->

    <!-- 查看用户资料 -->
    <div class="modal" id="updateUser" tabindex="-1" role="dialog">
        <div class="modal-dialog" role="document" style="margin-top:100px; ">
            <div class="modal-content" style="border-radius:10px">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel1">个人资料</h4>
                </div>
                <div class="modal-body">
                    <div>
                        <label for="nickName">姓名</label>
                        <input type="text" class="form-control" id="nickName" name="nickName"/>
                    </div>

                    <div>
                        <label for="email">邮箱地址</label>
                        <input type="text" class="form-control" id="email" name="email"/>
                    </div>

                    <div>
                        <label for="phone">手机号码</label>
                        <input type="text" class="form-control" id="phone" name="phone"/>
                    </div>

                    <div>
                        <label for="birthday">生日</label>
                        <div class="input-group">
                      <span style="position: relative; z-index: 1080;">
                      	<input class="form_datetime form-control" style="z-index: 1080; " id="birthday" name="birthday"
                               type="text" readonly>
                      </span>
                            <span class="input-group-addon">
                      	<i class="fa fa-calendar"></i>
                      </span>
                        </div>
                    </div>


                    <div>
                        <label for="sex">性别</label>
                        <select class="form-control" id="sex" name="sex" data-bv-field="country">
                            <option value="0">男</option>
                            <option value="1">女</option>
                        </select>
                    </div>

                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" onclick="updateUser()">保存</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 修改密码 -->
    <div class="modal" id="updateUserPassword" tabindex="-1" role="dialog">
        <div class="modal-dialog" role="document" style="margin-top:100px;">
            <div class="modal-content" style="border-radius:10px">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">修改密码</h4>
                </div>
                <div class="modal-body">
                    <div>
                        <label for="usedpwd">用户密码</label>
                        <input type="password" class="form-control" id="usedpwd" name="usedpwd"
                               placeholder="usedPassword"/>
                    </div>
                    <div>
                        <label for="newpwd">新密码</label>
                        <input type="password" class="form-control" id="newpwd" name="newpwd"
                               placeholder="newPassword"/>
                    </div>
                    <div>
                        <label for="verifypwd">确认密码</label>
                        <input type="password" class="form-control" id="verifypwd" name="verifypwd"
                               placeholder="verifyPassword"/>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" onclick="updateUserPassword()">保存</button>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">

    //$('#myModal').on('shown.bs.modal', function () {
    //$('#myInput').focus()
    //})


    //打开用户详情
    function showUser() {
        var nickName = "${userInfo.nickName!}";//昵称
        var email = "${userInfo.email!}";//邮箱
        var phone = "${userInfo.phone!}";//手机号码
        var birthday = "${userInfo.birthday!}";//生日
        var sex = "${userInfo.sex!}";//性别
        $("#sex").val(sex);
        $("#nickName").val(nickName);
        $("#email").val(email);
        $("#phone").val(phone);
        $("#birthday").val(birthday);

        LoadDatepicker();

        $('#updateUser').modal('show');

    }


    //保存
    function updateUser() {
        var data = {
            nickName: $("#nickName").val(),
            sex: $("#sex").val(),
            email: $("#email").val(),
            phone: $("#phone").val(),
            birthday: $("#birthday").val()
        };
        $.ajax({
            url: contextPath + "/soa/manage/update",
            data: data,
            type: "post",
            dataType: "json",
            async: false,
            success: function (result) {
                if (result.status == 0) {
                    var d = dialog({
                        zIndex: 1080,
                        content: result.msg
                    });
                    d.show();
                    setTimeout(function () {
                        d.close().remove();
                    }, 2000);
                    $('#updateUser').modal('hide');
                } else if (result.status == 1) {
                    var d = dialog({
                        zIndex: 1080,
                        content: result.msg
                    });
                    d.show();
                    setTimeout(function () {
                        d.close().remove();
                    }, 2000);
                } else if (result.status == 2) {
                    var d = dialog({
                        zIndex: 1080,
                        content: result.msg
                    });
                    d.show();
                    setTimeout(function () {
                        d.close().remove();
                    }, 2000);
                }

            },
            error: function () {
                alert('修改失败!');
            }
        });

    }


    //打开修改密码框
    function showPassword() {
        $('#updateUserPassword').modal('show');
    }

    //修改密码
    function updateUserPassword() {
        var data = {usedpwd: $("#usedpwd").val(), newpwd: $("#newpwd").val(), verifypwd: $("#verifypwd").val()};

        $.ajax({
            url: contextPath + "/soa/manage/password/update",
            data: data,
            type: "post",
            dataType: "json",
            async: false,
            success: function (result) {

                if (result.status == 0) {
                    var d = dialog({
                        zIndex: 1080,
                        content: result.msg
                    });
                    d.show();
                    setTimeout(function () {
                        d.close().remove();
                    }, 2000);

                    $('#updateUser').modal('hide');

                } else if (result.status == 1) {
                    var d = dialog({
                        zIndex: 1080,
                        content: result.msg
                    });
                    d.show();
                    setTimeout(function () {
                        d.close().remove();
                    }, 2000);
                } else if (result.status == 2) {
                    var d = dialog({
                        zIndex: 1080,
                        content: result.msg
                    });
                    d.show();
                    setTimeout(function () {
                        d.close().remove();
                    }, 2000);
                }

            },
            error: function () {
                alert('修改失败!');
            }
        });
    }

    //退出登录
    function quit() {
        var d = dialog({
            title: '提示',
            content: '你确定要退出系统吗？',
            okValue: '确认',
            ok: function () {
                $.post(contextPath + "/logout", function (data) {
                    location.reload();
                });
            },
            cancelValue: '取消',
            cancel: function () {
            }

        });
        d.showModal();
    }


    //加载时间控件
    function LoadDatepicker() {
        $('.form_datetime').datepicker({
            language: 'zh-CN',
            format: 'yyyy-mm-dd',
            weekStart: 1,
            autoclose: true,
            forceParse: false

        });
    }
</script>

<script src="${request.contextPath}/js/app.js"></script>
<script src="${request.contextPath}/js/utils.js"></script>
<script src="${request.contextPath}/js/sidebar-menu.js"></script>
<script src="${request.contextPath}/js/init.js"></script>
<script type="text/javascript" src="${request.contextPath}/lib/plugins/layer/layer.js"></script>
<script src="${request.contextPath}/js/jquery-form.js"></script>
<script src="${request.contextPath}/js/diy_tips.js"></script>
<script src="${request.contextPath}/js/sockjs.min.js"></script>
<!--引用百度地图API-->
<script src="http://api.map.baidu.com/api?v=1.4" type="text/javascript"></script>


<script type="text/javascript">

    //syrvey();

    function syrvey() {
        var status;

        //获取是否有维保厂商需要评论
        $.ajax({
            url: contextPath + "/soa/survey/evaluatemanuf/datas/search",
            type: "post",
            dataType: "json",
            async: false,
            success: function (result) {
                status = result.status;
            }
        });


        //有厂商显示评论框
        if (status == 0) {
            post("/soa/survey/show", "html", "", function (obj) {
                var d = dialog({
                    content: obj,
                    width: 1500,
                    okValue: '提交',
                    zIndex: 999999,
                    ok: function () {

                        var asmpSurveyBusinesses = [];


                        var checked = false;

                        var len = $('#surveyTable tbody tr').length;


                        $('#surveyTable tbody tr').each(function (i, el) {
                            var name = $(el).find('td').eq(1).html();
                            var id = $(el).find('td').eq(0).html();
                            var data = {};

                            var chk1check = false;
                            var chk1name = '受理及时率';

                            var chk2check = false;
                            var chk2name = '维保修复率';

                            var chk3check = false;
                            var chk3name = '服务态度';

                            data.id = id;


                            $(el).find(':checkbox[name="chk1"]').each(function (i, el) {
                                var tt = $(el).prop('checked');

                                if (tt == true) {
                                    chk1check = true;
                                    data.timelinessGrade = $(el).attr('thevalue');

                                    return false;
                                } else {
                                    chk1check = $(el).prop('checked');
                                }

                            });

                            $(el).find(':checkbox[name="chk2"]').each(function (i, el) {
                                var tt = $(el).prop('checked');
                                if (tt == true) {
                                    chk2check = true;
                                    data.repairGrade = $(el).attr('thevalue');

                                    return false;
                                } else {
                                    chk2check = false;
                                }

                            });


                            $(el).find(':checkbox[name="chk3"]').each(function (i, el) {
                                var tt = $(el).prop('checked');

                                if (tt == true) {
                                    chk3check = true;
                                    data.mannerGrade = $(el).attr('thevalue');
                                    return false;
                                } else {
                                    chk3check = false;
                                }

                            });


                            if (!chk1check == true) {
                                var ck1 = dialog({
                                    content: '请给' + name + chk1name + '评分'
                                });
                                ck1.show();
                                setTimeout(function () {
                                    ck1.close().remove();
                                }, 2000);
                                return false;
                            }

                            if (!chk2check == true) {

                                var ck2 = dialog({
                                    content: '请给' + name + chk2name + '评分'
                                });
                                ck2.show();
                                setTimeout(function () {
                                    ck2.close().remove();
                                }, 2000);
                                return false;
                            }
                            if (!chk3check == true) {
                                var ck3 = dialog({
                                    content: '请给' + name + chk3name + '评分'
                                });
                                ck3.show();
                                setTimeout(function () {
                                    ck3.close().remove();
                                }, 2000);
                                return false;
                            }

                            if (chk1check == true && chk2check == true && chk3check == true) {
                                //成功thedata提交数据
                                asmpSurveyBusinesses.push(data);
                                len--;


                            }

                        });


                        if (len == 0) {
                            $.ajax({
                                type: "POST",
                                url: contextPath + "/soa/survey/surveybusiness/datas/edit",
                                dataType: "json",
                                contentType: "application/json",
                                data: JSON.stringify(asmpSurveyBusinesses),
                                success: function (msg) {
                                    d.close().remove();
                                }
                            });

                        }
                        return false;
                    }
                });
                d.showModal();
            });
        }
    }
    var websocket = null;
    if ('WebSocket' in window) {
        websocket = new WebSocket("ws://localhost:8080/admin/websocket/webSocketServer.do");
    }
    else if ('MozWebSocket' in window) {
        websocket = new MozWebSocket("ws://localhost:8080/admin/websocket/webSocketServer.do");
    }
    else {
        websocket = new SockJS("http://localhost:8080/admin/sockjs/webSocketServer.do");
    }
    websocket.onopen = onOpen;
    websocket.onmessage = onMessage;
    websocket.onerror = onError;
    websocket.onclose = onClose;

    function onOpen(openEvt) {
        //alert(openEvt.Data);
    }

    function onMessage(evt) {
//        alert(evt.data);
        console.log(evt.data);
        $('#chatAudio')[0].play();
        layer.alert(evt.data, {
            icon: 1,
//            type: 2,
            title: "消息提醒",
            shade: [0],
            area: ['340px', '215px'],
            offset: 'rb', //右下角弹出
            time: 3000, //2秒后自动关闭
            anim: 2
        });

    }
    function onError() {}
    function onClose() {}
</script>
</body>
</html>
